package com.AAA.controller;


import com.AAA.entity.LayData;
import com.AAA.entity.MyPage;
import com.AAA.entity.Trole;
import com.AAA.service.ITroleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("tRole")
public class TroleController {

    @Autowired
    private ITroleService service;

    //添加 and 修改
    @RequestMapping("add")
    public LayData add(Trole trole){
        return new LayData(service.add(trole));
    }
    //分页查询
    @RequestMapping ("query")
    public LayData query(MyPage myPage,Trole trole){
        return service.query(myPage,trole);
    }
    //删除
    @RequestMapping("delete")
    public LayData delete(Trole trole){
        String b = service.delete(trole);
        return new LayData(b);
    }
    @GetMapping
    public LayData queryAll(MyPage myPage,Trole trole){

        return new LayData(service.findAll(myPage,trole));
    }
    @PostMapping("queryById")
    public LayData queryById(String rid){

        return service.queryById(rid);

    }
}